# -*- coding: utf8 -*-
# $Id :  $



# Copyright 2008-2010, Pascal Fautrero & JCharles
#
# This file is part of PyArchiver.
# 
# PyArchiver is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PyArchiver is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyArchiver.  If not, see <http://www.gnu.org/licenses/>.



# Import packages

import wx                        # This module uses the new wx namespace
import images

_ = wx.GetTranslation            # Define _ or add _ to builtins in your app file

#---------------------------------------------------------------------------

class My_MenuBar(wx.MenuBar):
    def __init__(self, parent):
        wx.MenuBar.__init__(self)
        
        #-------------------------------------------------------------------
        
        self.parent = parent
        
        ####################################################################

        # Add a File menu        
        menuFile = wx.Menu(style=wx.MENU_TEAROFF)
        
        ####################################################################

        bmp = images.Item_Save.GetBitmap()
        
        item = wx.MenuItem(menuFile, 500,
                           text=_("&Save Source\tCtrl+S"),
                           help=_("Save source in the database."))
        item.SetBitmap(bmp)
        menuFile.AppendItem(item)
        
        #-------------------------------------------------------------------

        bmp = images.Item_Print.GetBitmap()
                        
        item = wx.MenuItem(menuFile, 501,
                           text=_("&Print Support\tCtrl+P"),
                           help=_("Print the content of support selected."))
        item.SetBitmap(bmp)
        menuFile.AppendItem(item)
        menuFile.AppendSeparator()
        
        #-------------------------------------------------------------------

        bmp = images.Item_Exit.GetBitmap()
                        
        item = wx.MenuItem(menuFile, 502,
                           text=_("&Quit\tCtrl+Q"),
                           help=_("Quit this application."))
        item.SetBitmap(bmp)
        menuFile.AppendItem(item)
        wx.App.SetMacExitMenuItemId(item.GetId())
        
        ####################################################################

        # Add a Edit menu         
        menuEdit = wx.Menu(style=wx.MENU_TEAROFF)
        
        ####################################################################

        bmp = images.Item_Delete.GetBitmap()
                        
        item = wx.MenuItem(menuEdit, 503,
                           text=_("&Delete Entry\tCtrl+D"),
                           help=_("Removes source or support of the database."))
        item.SetBitmap(bmp)
        menuEdit.AppendItem(item)
        menuEdit.AppendSeparator()
        
        #-------------------------------------------------------------------
        
        # Create a sub menu
        submenu = wx.Menu(style=wx.MENU_TEAROFF)

        #-------------------------------------------------------------------

        bmp = images.Item_Preferences.GetBitmap()
                        
        item = wx.MenuItem(submenu, 504,
                           text=_("&Generals...\tCtrl+K"),
                           help=_("Generals settings."))
        item.SetBitmap(bmp)
        submenu.AppendItem(item)
        
        #-------------------------------------------------------------------
        #-------------------------------------------------------------------
      
        # Append sub menu to the menu "Edit" 
        menuEdit.AppendMenu(-1, _("&Preferences"), submenu)
        
        ####################################################################

        # Add a View menu           
        menuView = wx.Menu(style=wx.MENU_TEAROFF)
        
        ####################################################################

        bmp = images.Item_RollUp.GetBitmap()
                        
        item = wx.MenuItem(menuView, 505,
                           text=_("&Roll\tF3"),
                           help=_("Reduced the application to its title bar."))
        item.SetBitmap(bmp)
        menuView.AppendItem(item)
        
        #-------------------------------------------------------------------

        bmp = images.Item_Unroll.GetBitmap()
                        
        item = wx.MenuItem(menuView, 506,
                           text=_("&Unroll\tF4"),
                           help=_("Restores the application to its original size."))
        item.SetBitmap(bmp)
        menuView.AppendItem(item)
        menuView.AppendSeparator()
        
        #-------------------------------------------------------------------

        bmp = images.Item_PyCrust.GetBitmap()
                        
        item = wx.MenuItem(menuView, 507,
                           text=_("Py&Shell\tF5"),
                           help=_("An interactive interpreter window with the app and frame objects in the namespace."))
        item.SetBitmap(bmp)
        menuView.AppendItem(item)
        
        #-------------------------------------------------------------------

        bmp = images.Item_wxWidgets.GetBitmap()
                        
        item = wx.MenuItem(menuView, 508,
                           text=_("&Widget Inspector\tF6"),
                           help=_("A tool that lets you browse the live widgets and sizers in an application."))
        item.SetBitmap(bmp)
        menuView.AppendItem(item)

        ####################################################################
        ####################################################################

        # Add a Help menu          
        menuHelp = wx.Menu(style=wx.MENU_TEAROFF)
        
        ####################################################################
        ####################################################################

        bmp = images.Item_Note.GetBitmap()
                        
        item = wx.MenuItem(menuHelp, 509,
                           text=_("Me&mento\tCtrl+M"),
                           help=_("Memento."))
        item.SetBitmap(bmp)
        menuHelp.AppendItem(item)
        menuHelp.AppendSeparator()
        
        #-------------------------------------------------------------------
        #-------------------------------------------------------------------

        bmp = images.Item_Help.GetBitmap()
                        
        item = wx.MenuItem(menuHelp, 510,
                           text=_("&About...\tCtrl+A"),
                           help=_("About this application."))
        item.SetBitmap(bmp)
        menuHelp.AppendItem(item)
        wx.App.SetMacAboutMenuItemId(item.GetId())
        
        ####################################################################
        ####################################################################

        # Add some menu to the menubar
        self.Append(menuFile, title=_("&File"))
        self.Append(menuEdit, title=_("&Edit"))
        self.Append(menuView, title=_("&View"))
        self.Append(menuHelp, title=_("&?"))


